import { from } from 'form-data'
import { request } from './request'

import { TEST_URL, PROD_URL, PRINT_BASE_URL } from '@/constant/config.js'
import { SET_BASEURL, PRINT_BASE } from '@/constant/index.js' // 设置的请求地址

let isDev = process.env.NODE_ENV === 'development'
let setBaseUrl = uni.getStorageSync(SET_BASEURL) || ''
let baseUrl = isDev ? TEST_URL : PROD_URL
baseUrl = !setBaseUrl.length ? baseUrl : setBaseUrl

let printId = uni.getStorageSync(PRINT_BASE) + '' || ''
let printUrl = !printId.length > 0 ? PRINT_BASE_URL : printId
let joburl="http://172.16.100.133:8002" //调用iot的job接口

/**
 * 登录
 * @param data
 * @returns {FlyPromise<any>}
 */
export const logIn = data => request.post(baseUrl + '/system/app/login', data)

/**
 * 获取当前用户权限
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getUserPermission = data => request.post(baseUrl + '/system/app/getAppAuthorizedMenuAndBtn', data)

/**
 * 获取当前字典数据
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getDataDictionary = data =>
    request.post({
        url: baseUrl + '/system/dicSet/getDicItemByCode',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })

/**
 * 获取条码信息
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getMaterialCodeInfo = data => request.post(baseUrl + '/wms/invBarcode/selectInvBarcode', data)

/**
 * 查询来料入库单信息
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getIncomingMaterial = data => request.post(baseUrl + '/qms/wmsInstockH/findInStockHPage', data)

/**
 * 根据物料code查询当前物料检测项
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findRelationByCode = data => request.post(baseUrl + '/qms/qmsRelationH/findRelationByCode', data)

/**
 * 提交来料检测结果
 * @param data
 * @returns {FlyPromise<any>}
 */
export const insertIqcCheck = data => request.post(baseUrl + '/qms/qmsIqcCheckH/insertIqcCheck', data)

/**
 * 查询成品检验barcode
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectWmsBarcodeInfo = data => request.post(baseUrl + '/qms/wmsBarcode/selectWmsBarcodeInfo', data)

/**
 * 提交成品检验结果
 * @param data
 * @returns {FlyPromise<any>}
 */
export const insertFqcCheck = data => request.post(baseUrl + '/qms/qmsFqcCheckH/insertFqcCheck', data)

/**
 * 获取过程检验首页检测数据
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectPqcCheckByShift = data => request.post(baseUrl + '/qms/qmsPqcCheckH/selectPqcCheckByShift', data)

/**
 * 获取过程检验首页具体班次每一行的产线纬度检测信息
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectPqcItemCheckResult = data => request.post(baseUrl + '/qms/qmsPqcCheckH/selectCheckResult', data)
/**
 * 获取过程检验首页具体班次每一行的产线纬度检测信息（新查看）
 * @param data
 * @returns {FlyPromise<any>}
 */
export const newSelectCheckResult = data => request.post(baseUrl + '/qms/qmsPqcCheckH/newSelectCheckResult', data)

/**
 * 获取二次检验数据
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getSecondTestList = data => request.post(baseUrl + '/wms/wmsBarcode/checkFailBarcodeListForPda', data)

/**
 * 二次检验根据barcode查询物料详情
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectWmsBarcodeInfoWms = data => request.post(baseUrl + '/wms/wmsBarcode/selectWmsBarcodeInfo', data)

/**
 * 弹窗确认二次检验提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const splitBarcodeForSecondCheck = data =>
    request.post(baseUrl + '/wms/wmsBarcode/splitBarcodeForSecondCheck', data)

/**
 * WMS校验木托盘有没有被绑定
 * @param data
 * @returns {FlyPromise<any>}
 */
export const checkQrCodeIsBindWMS = data => request.post(baseUrl + '/wms/wmsBarcode/checkQrCodeIsBind', data)

/**
 * 批量提交二次检测结果
 * @param data
 * @returns {FlyPromise<any>}
 */
export const updateSecondQcStatusForPda = data =>
    request.post(baseUrl + '/wms/wmsBarcode/updateSecondQcStatusForPda', data)

/**
 * 来料入库 查询收料通知单列表
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findReceiptHs = data => request.post(baseUrl + '/wms/wmsReceiptH/findReceiptHs', data)

/**
 * 来料入库 查询收料通知单详情 来料入库五金仓入库 查询收料通知单详情
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findReceiptHById = data => request.post(baseUrl + '/wms/wmsReceiptH/findReceiptHById', data)
/**
 * 根据code查询仓库 五金仓传SP
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getWmsWarehouseByCode = data => request.post(baseUrl + '/wms/wmsWarehouse/getWmsWarehouseByCode', data)
/**
 * 根据仓库的code 查询库位信息
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getLocationByWarehouseCode = data =>
    request.post(baseUrl + '/wms/wmsLocationCapacity/getLocationByWarehouseCode', data)

/**
 * 根据barcode查询物料详情
 * @param data
 * @returns {FlyPromise<any>}
 */
export const wmsSelectWmsBarcodeInfo = data => request.post(baseUrl + '/wms/wmsBarcode/selectWmsBarcodeInfo', data)
/**
 * 根据barcode查询仓库中的物料
 */
export const selectWmsCheckstockDByBarcodeAndCheckStockId = data => request.post(baseUrl + '/wms/wmsCheckstockD/selectOneByCode', data)

/**
 * 根据barcode查询物料详情
 * @param data
 * @returns {FlyPromise<any>}
 */
export const wjInCommit = data => request.post(baseUrl + '/wms/wmsBarcode/wjInCommit', data)
/**
 * 来料入库 提交来料入库
 * @param data
 * @returns {FlyPromise<any>}
 */
export const wmsCommitReceipt = data => request.post(baseUrl + '/wms/wmsReceiptH/commitReceipt', data)
/**
 * 采购退料 查询采购入库单 采购退料五金仓退料 查询采购入库单
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getWmsInStockPage = data => request.post(baseUrl + '/wms/wmsInstockH/getWmsInStockPage', data)
export const getPurInstockList = data => request.post(baseUrl + '/wms/srmPoheader/GetPurInstockList', data)

/**
 * 采购退料 查询采购入库单详情
 * @param data
 * @returns {FlyPromise<any>}
 */
export const wmsInStockInfoById = data => request.post(baseUrl + '/wms/srmPoheader/GetPurInstockList', data)
/**
 * 采购退料 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const commitRefund = data => request.post(baseUrl + '/wms/wmsBarcode/sapCommitRefund', data)

/**
 * 五金仓返还 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const commitwjInCommit = data => request.post(baseUrl + '/wms/wmsBarcode/wjInCommit', data)

/**
 * 五金仓出库 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const wjOutCommit = data => request.post(baseUrl + '/wms/wmsBarcode/wjOutCommit', data)

/**
 * 粉碎简单生产退料 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const iqcOutCommits = data => request.post(baseUrl + '/wms/wmsBarcode/otherInCommit', data)

/**
 * 其他出库 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const iqcOutCommit = data => request.post(baseUrl + '/wms/wmsBarcode/wjOutCommit', data)

/**
 *  库内调整
 * @param {*} data
 * @returns
 */
export const houseLocationChange = data => request.post(baseUrl + '/wms/wmsBarcode/houseLocationChange', data)
/**
 * 物料调拨 提交
 * @param {*} data
 * @returns
 */
export const materialTransfer = data => request.post(baseUrl + '/wms/wmsBarcode/materialTransfer', data)
/**
 * 获取某道工序的具体待检产线
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectMeetLine = data => request.post(baseUrl + '/qms/qmsPqcCheckH/selectMeetLine', data)

/**
 * 过程检测 提交开始检测时间
 * @param data
 * @returns {FlyPromise<any>}
 */
export const fillStartTime = data => request.post(baseUrl + '/qms/qmsPqcCheckH/fillStartTime', data)

/**
 * 过程检测查询检测项目
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectCheckProject = data => request.post(baseUrl + '/qms/qmsPqcCheckH/selectCheckProject', data)
/**
 * 查询所有检测项接口
 * @param data
 * @returns {FlyPromise<any>}
 */
export const newSelectCheckProject = data => request.post(baseUrl + '/qms/qmsPqcCheckH/newSelectCheckProject', data)

/**
 * 过程检测查询检测项目的符合产线
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectMeetLineSecond = data => request.post(baseUrl + '/qms/qmsPqcCheckH/selectMeetLine', data)

/**
 * 过程检测查询检测项目的所有产线
 * @param data
 * @returns {FlyPromise<any>}
 */
export const newSelectMeetLine = data => request.post(baseUrl + '/qms/qmsPqcCheckH/newSelectMeetLine', data)

/**
 * 过程检测提交检测结果
 * @param data
 * @returns {FlyPromise<any>}
 */
export const insertPQCCheckResult = data => request.post(baseUrl + '/qms/qmsPqcCheckH/insertPQCCheckResult', data)
/**
 * 过程检测提交检测结果新
 * @param data
 * @returns {FlyPromise<any>}
 */
export const newInsertPQCCheckResult = data => request.post(baseUrl + '/qms/qmsPqcCheckH/newInsertPQCCheckResult', data)

/**
 * 过程检测提交检测结果编辑后更新
 * @param data
 * @returns {FlyPromise<any>}
 */
export const updateCheckProject = data => request.post(baseUrl + '/qms/qmsPqcCheckD/updateCheckProject', data)

/**
 * 拆分条码接口
 * @param data
 * @returns {FlyPromise<any>}
 */
export const splitBarcodeApi = data => request.post(baseUrl + '/wms/wmsBarcode/splitBarcode', data)

/**
 * 合并条码
 * @param data
 * @returns {FlyPromise<any>}
 */
export const mergeBarcodeApi = data => request.post(baseUrl + '/wms/wmsBarcode/mergeBarcode', data)

/**
 * 上基材调出 查询送货单列表 销售出库
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findDnHs = data => request.post(baseUrl + '/wms/wmsDnH/findDnHs', data)


/**
 * 上基材调出 查询送货单列表 销售出库
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findk3DnHs = data => request.post(joburl + '/job/distributedTransferOut/GetDistributedTransferOutDNList', data)

/**
 *  分布式调出 扫描条码
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getMaterialCodeInfOut = data => request.post(joburl + '/job/distributedTransferOut/ScanDistributedTransferOutBarcode', data)



/**
 * 上基材调出 查询送货单详情
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findK3WmsDnHById = data => request.post(joburl + '/job/distributedTransferOut/GetDistributedTransferOutDNById', data)


/**
 * 上基材调出 条码信息
 * @param data
 * @returns {FlyPromise<any>}
 */
export const scanDistributedTransferOutBarcode = data => request.post(joburl + '/job/distributedTransferOut/ScanDistributedTransferOutBarcode', data)



/**
 * 上基材调出 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const submitDistributedTransferOut = data => request.post(joburl + '/job/distributedTransferOut/SubmitDistributedTransferOut', data)


/**
 * 上基材调出 查询送货单详情
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findWmsDnHById = data => request.post(baseUrl + '/wms/wmsDnH/findWmsDnHById', data)

/**
 * 上基材调出  销售出库  提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const sdistributedCallOut = data => request.post(baseUrl + '/wms/wmsBarcode/distributedCallOut', data)

/**
 * 上基材调入 查询调出单列表
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectStepoutH = data => request.post(baseUrl + '/wms/wmsStepoutH/selectStepoutH', data)

/**
 * 库位请求
 * @param data
 * @returns {FlyPromise<any>}
 */
export const locationRequest = (url, data) => request.post(baseUrl + url, data)
export const locationRequestFrom = (url, data) =>
    request.post({
        url: baseUrl + url,
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })
/**
 * 上基材调入 查询调出单详情
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findStepoutHById = data => request.post(baseUrl + '/wms/wmsStepoutH/findStepoutHById', data)

/**
 * 上基材调入 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const distributedCallIn = data => request.post(baseUrl + '/wms/wmsStepoutH/distributedCallIn', data)

/**
 * 简单生产领料 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const simpleProductionPicking = data => request.post(baseUrl + '/wms/wmsBarcode/simpleProductionPicking', data)

/**
 * 获取当前时间
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getSystemTime = data => request.post(baseUrl + '/qms/qmsRelationH/getSystemTime', data)

/**
 * 生产检验 根据工序查询产线信息
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findLineByProcessCode = data =>request.post(baseUrl + '/wms/mesProductionline/findLineByProcessCode', data)

/** 
 * 生产检验 根据生产工序获取生产检验明细
 */
export const getProductionCheckByProcCode = data => request.post({
        url: baseUrl + '/qms/qmsProductionCheck/getProductionCheckByProcCode',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })
/**
 * 生产检验 根据产出物料查发泡板或者上基材
 */
export const getBomDByProdMaterial = data => request.post({
        url: baseUrl + '/qms/qmsProductionCheck/getBomDyProdMaterial',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })

/**
 * 生产检验 根据提交人查询
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getOperator = data =>request.post(baseUrl + '/qms/mesErrorRecord/getOperator', data)

/**
 * 生产检验 根据工序查询检测项目
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findCheckDataProductTest = data => request.post(baseUrl + '/wms/qmsProductionCheck/findCheckData', data)
/**
 * 生产检验 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const commitErrorRecord = data => request.post(baseUrl + '/wms/mesErrorRecord/commitErrorRecord', data)

/**
 * 生产检验 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findErrorRecord = data => request.post(baseUrl + '/wms/mesErrorRecord/findErrorRecord', data)
/**
 * 盘点列表
 * @param {*} data
 * @returns
 */
export const findStartCheckStock = data => request.post(baseUrl + '/wms/wmsCheckstockH1/findStartCheckStock', data)
/**
 * 盘点详情
 * @param {*} data
 * @returns
 */
export const findStartCheckStockDetail = data =>
    request.post(baseUrl + '/wms/wmsCheckstockH1/findStartCheckStockDetail', data)

/**
 * 盘点提交
 * @param {*} data
 * @returns
 */
export const checkStockCommit = data => request.post(baseUrl + '/wms/wmsCheckstockH1/checkStockCommit', data)

/**
 * 盘点审核
 * @param {*} data
 * @returns
 */
export const checkStockAudit = data => request.post(baseUrl + '/wms/wmsCheckstockH1/checkStockAudit', data)

/**
 * 盘点 查询提交记录条码维度
 * @param {*} data
 * @returns
 */
export const getCheckBarcodeByHIdForPda = data =>
    request.post(baseUrl + '/wms/wmsCheckstockD/getCheckBarcodeByHIdForPda', data)

/**
 * 盘点 校验当前用户是否有盘点资格
 * @param {*} data
 * @returns
 */
export const inventoryStaff = data => request.post(baseUrl + '/wms/sysDicSet/inventoryStaff', data)

/**
 *  投料 扫描物料条码
 * @param data
 * @returns {FlyPromise<any>}
 */
export const barcodeInfoForFeeding = data =>
    request.post(baseUrl + '/wms/wmsBarcode/getBarcodeInfoForFeeding' + '?str=' + data)

/**
 *  查询所有仓库
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getIsUsePageSetPDA = data => request.post(baseUrl + '/wms/wmsWarehouse/getIsUsePageSetPDA', data)

/**
 *  查询品牌列表
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getErpBrand = data => request.post(baseUrl + '/wms/wmsReceiptH/getErpBrand', data)

/**
 *  退料 确定
 * @param data
 * @returns {FlyPromise<any>}
 */
export const returnOfMaterial = data => request.post(baseUrl + '/wms/mesBillsRule/createdCode' + '?ruleCode=' + data)

/**
 *  生产退料 提交 与 打印
 * @param data
 * @returns {FlyPromise<any>}
 */
// export const saveOfMaterial = data => request.post(baseUrl + '/mes/mesReturnRecord/save', data)
export const saveOfMaterial = data => request.post(baseUrl + '/wms/wmsCheckstockD/returnRecord', data)
export const printReturnRecord = data => request.post(baseUrl + '/mes/mesReturnRecord/printReturnRecord', data)

/**
 *  成品入库
 * @param data
 * @returns {FlyPromise<any>}
 */
export const productStorage = data => request.post(baseUrl + '/wms/wmsBarcode/productStorage', data)

/**
 *  打印机列表
 * @param data
 * @returns {FlyPromise<any>}
 */
export const bigBarCodePrintList = data =>
    request.post(baseUrl + '/mes/iotBaseinfoH/getIotBaseinfoDByCode?code=printerSetup', data)

// /**
//  *  打印机测试
//  * @param data
//  * @returns {FlyPromise<any>}
//  */
// export const bigBarCodePrint = data => request.post("http://192.168.30.60:8080/print/printTest", data)

/** 打印机测试
 * @param data
 * @returns {FlyPromise<any>}
 */
export const bigBarCodePrint = data =>
    request.post({
        url: printUrl + '/print/printTest',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })
/**
 *  获取用户信息
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getCurrentUser = data => request.post(baseUrl + '/mdata/user/getCurrentUser', data)

/**
 *  修改密码
 * @param data
 * @returns {FlyPromise<any>}
 */
export const updateModifyPassword = data =>
    request.post({
        url: baseUrl + '/mdata/user/updateModifyPassword',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })

/**
 *  版本更新
 * @param data
 * @returns {FlyPromise<any>}
 */
export const appUpdate = data =>
    request.post({
        url: baseUrl + '/mes/wmsAppUpdate/appUpdate',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })

/*  打印接口
 * @param data
 * @returns {FlyPromise<any>}
 */
export const printsLabels = data =>
    request.post({
        url: printUrl + '/print/RawMaterialBarCodePrint',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })
export const printsLabels1 = data =>
    request.post({
        url: printUrl + '/print/barCodePrint',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })
/**
 *  通知列表
 * @param data
 * @returns {FlyPromise<any>}
 */
export const listBizMessageByUserNameId = data =>
    request.post({
        url: baseUrl + '/digital/sysInfoBizMessage/getPageSetByUserNameId',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })

/**
 *  更新通知列表
 * @param data
 * @returns {FlyPromise<any>}
 */
export const updateReadFlag = data =>
    request.post({
        url: baseUrl + '/digital/sysInfoBizReceiver/updateReadFlag',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })

/**
 *  获取过程检验结果
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectLastResultById = data => request.post(baseUrl + '/qms/qmsPqcCheckH/selectLastResultById', data)

/**
 *  成品盘点  首页
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findCreateCheckStock = data => request.post(baseUrl + '/wms/wmsCheckstockH/findCreateCheckStock', data)

/**
 *  成品盘点  首页（新）
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findFGStartCheckStock = data => request.post(baseUrl + '/wms/wmsCheckstockH1/findFGStartCheckStock', data)

/**
 *  成品盘点  二级页面顶部
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectK3andMESTotal = data => request.post(baseUrl + '/wms/wmsCheckstockH/SelectK3andMESTotal', data)

/**
 *  成品盘点  二级页面详细盘点单
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectWmsCheckStocked = data => request.post(baseUrl + '/wms/wmsCheckstockH/selectWmsCheckstockd', data)

/**
 *  成品盘点  提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const checkStockSubmit = data => request.post(baseUrl + '/wms/wmsCheckstockH/checkStockSubmit', data)
/**
 *  成品盘点  提交 (新)
 * @param data
 * @returns {FlyPromise<any>}
 */
export const checkFGStockSubmit = data => request.post(baseUrl + '/wms/wmsCheckstockH1/checkFGStockSubmit', data)

/**
 *  物料调拨  提交中的第二个接口,将数据保存到投料记录
 * @param data
 * @returns {FlyPromise<any>}
 */
export const saveInputRecord = data => request.post(baseUrl + '/mes/mesInputRecord/saveInputRecord', data)

/**
 *  简单生产入库  提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const simpleProductionInstock = data => request.post(baseUrl + '/wms/wmsBarcode/simpleProductionInstock', data)
/**
 * 消息通知接口
 * @param data
 * @returns {FlyPromise<any>}
 */
// export const getNotReadMsg = data => request.post(baseUrl + "/wms/sysInfoBizMessage/getNotReadMsg", data)
export const getNotReadMsg = data =>
    request.post({
        url: baseUrl + '/wms/sysInfoBizMessage/getNotReadMsg',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })

export const getNotReadHomeMsg = data =>
    request.post({
        url: baseUrl + '/wms/sysInfoBizMessage/getIndexNotReadMsg',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })

/**
 *  标记消息已读
 * @param data
 * @returns {FlyPromise<any>}
 */
export const updateMsg = data =>
    request.post({
        url: baseUrl + '/wms/sysInfoBizReceiver/update',
        data: data,
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })

/**
 *  原材料转移  扫描条码
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectBarcodeForTransfer = data => request.post(baseUrl + '/wms/wmsBarcode/selectBarcodeForTransfer', data)

/**
 *  原材料转移  提交
 * @param data
 * @returns
 */
export const submitTransfer = data => request.post(baseUrl + '/wms/wmsBarcode/Transfer', data)

/**
 *  主页的库存
 * @param data
 * @returns
 */
export const getPADIndexData = data => request.post(baseUrl + '/wms/wmsBarcode/getPADIndexData', data)

/**
 *  图表界面的数据接口获取  饼图
 * @param data
 * @returns
 */
export const getPdaReportData = data => request.post(baseUrl + '/wms/wmsBarcode/getPdaReportData', data)

/**
 *  图表界面的数据接口获取   折线图
 * @param data
 * @returns
 */
export const getPdaLineGraph = data => request.post(baseUrl + '/wms/wmsBarcode/getPdaLineGraph', data)

/**
 *  首页的导航点击进去的库存查询界面
 * @param data
 * @returns
 */
export const inventoryQuery = data => request.post(baseUrl + '/wms/wmsBarcode/InventoryQuery', data)
/**
 *  首页的导航点击进去的库存查询界面 http://192.168.1.111:9770
 * @param data
 * @returns
 */
export const basPdaOperationLog = data => request.post(baseUrl + '/digital/basPdaOperationLog/save', data)

/**
 * 简单生产退料 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const simpleProductionReturn = data => request.post(baseUrl + '/wms/wmsBarcode/simpleProductionReturn', data)

/**
 *  主页的单据查询6个接口
 * @param data
 * @returns {FlyPromise<any>}
 */
export const pdaReport = data => request.post(baseUrl + '/wms/pdaReport/pdaReport', data)
/**
 *  原材料调拨  今日推荐用量
 * @param data
 * @returns {FlyPromise<any>}
 */
export const pickingApplication = data => request.post(baseUrl + '/wms/basMaterial/pickingApplication', data)
export const pickingApplication1 = data => request.post(baseUrl + '/wms/basMaterial/pickingApplication1', data)

/**
 *  上基材的投料 优先级
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getLvtInfo = data => request.post(baseUrl + '/mes/mesLVTFeeding/notoken/getLvtInfo', data)


/**
 *  获取打印机的服务器地址
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getDetailByCodeId = data => request.post(baseUrl + '/system/config/getDetailByCode?code=printEquipAddress')

/**
 * 获取SOP目录
 */
export const getSopCategory = () => request.post({
    url: baseUrl + '/system/codeItem/getListByPid',
    data: {
        id: '39CF47B366C846C6B3F1848A7BEB1927',
        pid: '39CF47B366C846C6B3F1848A7BEB1927'
    },
    header: {
        'content-type': 'application/x-www-form-urlencoded'
    }
})
/**
 * 获取SOP列表
 * @param title
 * @param categoryId
 * @param page
 * @param rows
 * @returns {Request<AjaxResponse<any>>}
 */
export const getSopPageSet = (title, categoryId, page, rows) => {
    return request.post({
        url: baseUrl + '/system/archive/getPageSetData',
        data: {
            title: title,
            categoryId: categoryId,
            page: page || 1,
            rows: rows || 10
        },
        header: {
            'content-type': 'application/x-www-form-urlencoded'
        }
    })
}
/**
 * 获取sop
 * @param uuid
 * @returns {Request<AjaxResponse<any>>}
 */
export const getSopDetail = uuid => request.get(baseUrl + "/system/archive/getDetailByUuid?uuid=" + uuid)

/**
 * 获取SOP文件列表
 * @param uuid
 * @returns {Request<AjaxResponse<any>>}
 */
export const getSopFiles = uuid => request.post(baseUrl + '/system/sysFile/listByBizId?bizId=' + uuid)

/**
 * 获取SOP文件列表的类型
 * @param uuid
 * @returns {Request<AjaxResponse<any>>}
 */
export const getViewType = uuid => request.post(baseUrl + '/system/sysFile/getViewType?bizId=' + uuid)

/**
 * 托盘合并 的扫描条码
 * @param data
 * @returns {FlyPromise<any>}
 */
export const PMScanningBarcode = data => request.get(baseUrl + '/wms/wmsBarcode/PMScanningBarcode?barcode=' + data.barcode + '&isIron=' + data.isIron)

/**
 * 托盘合并 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const PalletMerge = data => request.post(baseUrl + '/wms/wmsBarcode/PalletMerge', data)

/**
 * 推荐库位 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const recommendedLocationForCCP = data => request.post(baseUrl + '/wms/wmsLocationCapacity/recommendedLocationForCCP', data)


export const isBarcodeInStock = data => request.post(baseUrl + '/wms/wmsBarcode/isBarcodeInStock', data)

/**
 * 生产退料 盘点单号
 * @param data
 * @returns {FlyPromise<any>}
 */
export const findCheckStockHForPda = data => request.post(baseUrl + '/wms/wmsCheckstockH/findCheckStockHForPda', data)

/**
 * 拆分条码打印
 * @param data
 * @returns {FlyPromise<any>}
 */
export const barcodeSplitInfo = data => request.post(baseUrl + '/wms/wmsBarcode/barcodeSplitInfo', data)

/**
 * IOT扫描提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const updateD = data => request.post(baseUrl + '/mes/iotBaseinfoH/updateDetail?id=' + data.hid + '&barcode=' + data.value, {})

/**
 * 成品补录获取默认的点位和料号
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getFinishedProduct = data => request.post(baseUrl + '/wms/basMaterial/getFinishedProduct', data)

/**
 * 成品补录保存
 */
export const saveFinishedProduct = data => request.post(baseUrl + '/wms/wmsBarcode/finishedRecordSave', data)

/**
* 成品盘点顶部信息
* @param data
* @returns {FlyPromise<any>}
*/
export const getInventoryTopInfo = data => request.post(baseUrl + '/wms/wmsCheckstockD/getInventoryTopInfo', data)

/**
* 成品盘点总托数和物项总数
* @param data
* @returns {FlyPromise<any>}
*/
export const getTotalAndItems = data => request.post(baseUrl + '/wms/wmsCheckstockD/getTotalAndItems', data)

/**
*成品盘点库存信息
* @param data
* @returns {FlyPromise<any>}
*/
export const getInventoryInfo = data => request.post(baseUrl + '/wms/wmsCheckstockD/getInventoryInfo', data)



/**
*成品盘点库存详情和扫描记录
* @param data
* @returns {FlyPromise<any>}
*/
export const getDetailInfo = data => request.post(baseUrl + '/wms/wmsCheckstockD/getDetailInfo', data)


/**
*成品盘点点击盘点或者取消盘点
* @param data
* @returns {FlyPromise<any>}
*/
export const checkPDA = data => request.post(baseUrl + '/wms/wmsCheckstockD/checkPDA', data)

/**
* 条码变更 提交
* @param data
* @returns {FlyPromise<any>}
*/
export const changeBarcodeSubmit = data => request.post(baseUrl + '/wms/wmsBarcode/changeBarcodeSubmit', data)




/**
* 成品退库退料 提交
* @param data
* @returns {FlyPromise<any>}
*/
export const productReturnSubmit = data => request.post(baseUrl + '/wms/wmsBarcode/simpleProductionRetreat', data)


/**
* 成品补录  扫描条码
* @param data
* @returns {FlyPromise<any>}
*/
export const selectWmsBarcodeInfoForFPSupplement = data => request.post(baseUrl + '/wms/wmsBarcode/selectWmsBarcodeInfoForFPSupplement', data)



/**
* 成品退库退料 打印
* @param data
* @returns {FlyPromise<any>}
*/
export const getProductionRetreatBarcode = data => request.post(baseUrl + '/wms/wmsBarcode/getProductionRetreatBarcode', data)


/**
* 销售出库 推荐库位 
* @param data
* @returns {FlyPromise<any>}
*/
export const salesLocation = data => request.post(baseUrl + '/wms/wmsBarcode/salesLocation', data)

/**
* 销售出库 扫描记录里面的条码状态 
* @param data
* @returns {FlyPromise<any>}
*/
export const getBarcodeStatus = data => request.post(baseUrl + '/wms/wmsBarcode/getBarcodeStatus', data)

/**
* 销售出库检查扫描的条码是不是最早库位的条码
* @param data
* @returns {FlyPromise<any>}
*/
export const checkBarcodeTime = data => request.post(baseUrl + '/wms/wmsBarcode/checkFinishTime', data)

/**
* 销售出库检查扫描的条码是不是最早库位的条码
* @param data
* @returns {FlyPromise<any>}
*/
export const checkLocation = data => request.post(baseUrl + '/wms/wmsLocationCapacity/checkLocation', data)

/**
* 销售出库检查扫描的条码是不是最早库位的条码
* @param data
* @returns {FlyPromise<any>}
*/
export const getMaterialTransferBarcode = data => request.post(baseUrl + '/wms/wmsBarcode/getMaterialTransferBarcode', data)


/**
 * 来料入库库位明细*
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getLibraryNumber=data=>request.post(baseUrl + '/wms/wmsBarcode/getLibraryNumber', data)

/**
 * 来料入库物料明细
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getLibraryDetails=data=>request.post(baseUrl + '/wms/wmsBarcode/getLibraryDetails', data)

/**
 * 来料入库 扫描条码给目的库位赋值
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getLocationCodeByBarcode=data=>request.post(baseUrl + '/wms/wmsLocation/getLocationCodeByBarcode', data)
/**
 * 来料入库 扫描条码给判断是否为同一区域
 * @param data
 * @returns {FlyPromise<any>}
 */
export const isThereALibrary=data=>request.post(baseUrl + '/wms/wmsLocation/isThereALibrary', data)

/**
 * 开槽灰入库 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const slottedAshInstock=data=>request.post(baseUrl + '/wms/wmsBarcode/slottedAshInstock', data)

/**
 * 开槽灰入库 历史记录
 * @param data
 * @returns {FlyPromise<any>}
 */
export const slottedAshInstockHistory=data=>request.post(baseUrl + '/wms/WmsBarcodeBusinesslog/getPageSet', data)
/**
 * 开槽灰入库 删除
 * @param data
 * @returns {FlyPromise<any>}
 */
export const deleteSlottedAshInstock=data=>request.post(baseUrl + '/wms/WmsBarcodeBusinesslog/deleteSlottedAshInstock', data)
/**
 * 开槽灰出库 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const slottedAshOutstock=data=>request.post(baseUrl + '/wms/wmsBarcode/slottedAshOutstock', data)

/**
 * 库位条码详情 查询
 * @param data
 * @returns {FlyPromise<any>}
 */
export const barcodeByCondition=data=>request.post(baseUrl + '/wms/wmsBarcode/getBarcodeByCondition', data)

/**
 * 销售订单查询 查询
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getPageSetOrderH=data=>request.post(baseUrl + '/mes/mesSalesorderH/getPageSet?soDateStartTime='+data.soDateStartTime+'&soDateEndTime='+data.soDateEndTime+'&soCode='+data.soCode+'&pages='+data.pages+'&rows='+data.rows, data)

/**
 * 销售订单查询 查询
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getPageSetOrderD=data=>request.post(baseUrl + '/mes/mesSalesorderD/getPageSet?soid='+data.soid, data)

/**
 * 销售订单查询 打印
 * @param data
 * @returns {FlyPromise<any>}
 */
export const printBOL=data=>request.post(baseUrl + '/wms/hmtxPo/printBOL', data)

/**
 * 销售订单查询 上传
 * @param data
 * @returns {FlyPromise<any>}
 */
export const uploadBOL=data=>request.post(baseUrl + '/wms/hmtxPo/uploadBOL', data)

/**
 * 废板标记 扫描条码
 * @param data
 * @returns {FlyPromise<any>}
 */
export const getRestareaInfoScan=data=>request.post(baseUrl + '/mes/iotRestarea/getRestareaInfo?Barcode='+data.barcode)

/**
 * 废板标记 
 * @param data
 * @returns {FlyPromise<any>}
 */
export const modifyTrayStatusInRestArea=data=>request.post(baseUrl + '/mes/iotRestarea/ModifyTrayStatusInRestArea', data)

/**
 * 废板标记 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const noBarcodeOtherInCommit=data=>request.post(baseUrl + '/wms/wmsBarcode/noBarcodeOtherInCommit', data)

/**
 * NG明细 一级画面  查询
 * @param data
 * @returns {FlyPromise<any>}
 */
export const NGDetile=data=>request.post(baseUrl + '/wms/wmsBarcode/GetRestareaInfo', data)
/**
 * NG明细 二级画面变更记录  查询
 * @param data
 * @returns {FlyPromise<any>}
 */
export const NGGetRestareaStatusChangeRecords=data=>request.post(baseUrl + '/wms/wmsBarcode/GetRestareaStatusChangeRecords', data)

/**
* 大料入库  扫描罐体 获取物理
* @param data
* @returns {FlyPromise<any>}
*/
export const getProcessLocationByPrdLineId = data => request.post(baseUrl + '/mes/wmsBarcode/getTankAndMaterial'+ '?keyWord=' + data.keyWord)

/**
* 大料入库  提交
* @param data
* @returns {FlyPromise<any>}
*/
export const iOTOutputDataEntry = data => request.post(baseUrl + '/mes/wmsBarcode/GenerateBigMaterialInputRecord', data)

/**
 * 固资盘点 扫描条码
 * @param data
 * @returns {FlyPromise<any>}
 */
export const scanAssetCard_PDA = data => request.post(baseUrl + '/wms/wmsAssetCard/getDetails?assetCode='+data.assetCode)

/**
 * 固资管理 打印
 * @param data
 * @returns {FlyPromise<any>}
 */
export const printCardAssets = data => request.post(baseUrl + '/wms/wmsAssetCard/pdaPrint', data)

/**
 * 设备维修 部门获取
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectDepartment = data => request.post(baseUrl + '/digital/notoken/repair/selectDepartment', data)

/**
 * 设备维修 机台号
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectMachinet = data => request.post(baseUrl + '/digital/notoken/repair/selectMachine', data)

/**
 * 设备维修 故障类型
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectFaultType = data => request.post(baseUrl + '/digital/notoken/repair/selectFaultType', data)

/**
 * 设备维修 故障名称
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectEquipment = data => request.post(baseUrl + '/digital/notoken/repair/selectEquipment', data)

/**
 * 设备维修 故障严重程度
 * @param data
 * @returns {FlyPromise<any>}
 */
export const selectPriority = data => request.post(baseUrl + '/digital/notoken/repair/selectPriority', data)

/**
 * 设备维修 提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const addOrderEms = data => request.post(baseUrl + '/digital/repair/addOrder', data)

/**
 * 设备维修  查询自己提交的历史记录
 * @param data
 * @returns {FlyPromise<any>}
 */
export const orderByReporterld = data => request.post(baseUrl + '/digital/notoken/repair/getRepairOrderByReporterId', data)

/**
 * 半成品次品粉碎 扫描条码 
 * @param data
 * @returns {FlyPromise<any>}
 */
export const scanSemiProductBarcode = data => request.post(baseUrl + '/wms/wmsBarcode/selectWmsBarcodeInfo', data)
/**
 * 半成品次品粉碎  提交
 * @param data
 * @returns {FlyPromise<any>}
 */
export const submitSemiProductErrorCrush = data => request.post(baseUrl + '/wms/wmsBarcode/submitSemiProductErrorCrush', data)
